import Vue from 'vue'
import VueRouter from "vue-router";
import HomeView from '../views/frame.vue'
import ProjectDetail from "@/views/detail.vue";

Vue.use(VueRouter)
// src/router/index.js


const routes = [
  {
    path: '/',
    redirect: "home"
  },
  {
    path: '/home',
    name: 'home',
    component: HomeView,
    redirect: '/home/ArkProject',
    children:[
      {
        path:'ArkProject',
        name:'ArkProject',
        // component: require(/* webpackChunkName: "ArkProject" */'@/views/ArkProject.vue').default
        component:  r => require.ensure([], () => r(require('@/views/ArkProject.vue')), 'ArkProject')
      },
      {
        path: 'detail',
        name: 'detail',
        component: ProjectDetail
      },
      {
        path: 'Empty1',
       name: 'Empty1',
        // component: require(/* webpackChunkName: "Empty" */'@/views/Empty').default
        component:  r => require.ensure([], () => r(require('@/views/Empty.vue')), 'Empty')
      },
      {
        path: 'Empty2',
        name: 'Empty2',
        component: r => require.ensure([], () => r(require('@/views/Empty.vue')), 'Empty')
      },
      {
        path: 'Empty3',
        name: 'Empty3',
        component:  r => require.ensure([], () => r(require('@/views/Empty.vue')), 'Empty')
      },
      {
        path: 'Empty4',
        name: 'Empty4',
        component: r => require.ensure([], () => r(require('@/views/Empty.vue')), 'Empty')
      },
      {
        path: 'noticeList',
        name: 'noticeList',
        // component: require(/* webpackChunkName: "Empty" */'@/views/noticeList.vue').default
        component: r => require.ensure([], () => r(require('@/views/noticeList.vue')), 'NoticeList')
      }
    ]
  },
  {
    path: '/ProjectPreview/:id',
    name: 'ProjectPreview',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/ProjectPreview.vue')
  }
]

const router = new VueRouter({
  routes,
  linkActiveClass:'selected'
})

const VueRouterPush  = VueRouter.prototype.push
VueRouter.prototype.push = function push (to) {
  return VueRouterPush.call(this, to).catch(err => err)
}


export default router
